package com.foo.designpattern.state.state2;

/**
 * com.foo.designpattern.state
 * Created with IntelliJ IDEA.
 * Created by jiang on 2016-06-08 15:50.
 *
 * @Description
 */

public class RepeatVoteState implements VoteState {
    @Override
    public void vote(String user, String voteItem, VoteManager manager) {
        System.out.println("请不要重复投票！");
        if (manager.getMapVoteCount().get(user) >= 4) {
            // 在状态的处理类中进行状态的维护和转换
            manager.getMapState().put(user, new SpiteVoteState());
        }
    }
}
